define(['../module'], function(module) {
	module.directive('headerphoto', [ 'httpService',function(httpService) {
		 var photoHost = "http://test.staticoss.upesn.com/";
		 var subData="abcdefghijklmnopqrstuvwxyz";

		 var colorArr = ['29d4ff','1594ff','ffa92f','b587fa','06cf86','fa6771','73d51c','8991ff'];
		 function checkFileExt(filename){
				var flag = false; //状态
				var arr = ["jpg","png","gif","bmp","jpeg"];
				//取出上传文件的扩展名
				var index = filename.lastIndexOf(".");
				var ext = filename.substr(index+1);
				//循环比较
				for(var i=0;i<arr.length;i++)
				{
					if(ext == arr[i])
					{
					 flag = true; //一旦找到合适的，立即退出循环
					 break;
					}
				}
				if (filename.indexOf("default_avatar.jpg")>-1 || filename.indexOf("defaultGroup.gif")>-1) {
					return false;
				}
				//条件判断
				if(flag){
					return true;
				}else
				{
					return false;
				}
		 }
		 return {
					restrict:'AE',
					replace:true,
					scope:{
						item : "=item",
						size : "=size",
						info :"=info",
						fontsize : "=fontsize"
					},
					template:"<div class='avt-s-l' style='border-radius:0'></div>",
					link: function($scope, element, attrs) {
						var item = $scope.item;
						var info = $scope.info;
						// console.log(item);
						// console.log(attrs);
						var checkavatar = true;
						if (item && item.from && (item.from.avatar || item.from.photo)) {
							var photo = item.from.avatar || item.from.photo;
							checkavatar = checkFileExt(photo);
						} else if(item && item.group_logo){
							checkavatar = checkFileExt(item.group_logo);
						}
						if (attrs.align && item && !checkavatar) {
							element.css("vertical-align",attrs.align);
						}
						if (attrs.margintop && item &&  item.type == "groupchat" && item.from.members > 1) {
							element.css("margin-top",attrs.margintop);
						}
							if (!item) {
									window.setTimeout(function(){
										if($scope.info){
											var src;
											var itemname;
											itemname = $scope.info.name;
											src = $scope.info.avatar;

											if (src && src.indexOf("default_avatar.jpg")>-1) {
												src = "";
											}
											var i;
											var maxlength =  itemname.length;
											var minlength = (maxlength > 2 ) ? maxlength-2 : 0;
											var name = "";
											if(/.*[\u4e00-\u9fa5]+.*$/.test(itemname)){
												i = $.md5(itemname.substring(minlength,maxlength)).substring(0,1);
												name = itemname.substring(minlength,maxlength);
												if(subData.indexOf(i) > -1){
													i = subData.indexOf(i);
												}
												if (i>7) {
													i = (i+1)%8;
												}
											} else {
												var maxlength = (itemname.length < 2) ? itemname.length : 2;

												i = $.md5(itemname.substring(0,maxlength)).substring(0,1);
												name = itemname.substring(0,maxlength);
												if(subData.indexOf(i) > -1){
													i = subData.indexOf(i);
												}
												if (i>7) {
													i = (i+1)%8;
												}
											}
											var img =  new Image();
											if($scope.size){
												element.css("height",$scope.size);
												element.css("width",$scope.size);
												// borderSolid ="border:1px solid #dedede;";
												img.width = $scope.size;
												img.height = $scope.size;
											} else {

												img.width = 38;
												img.height = 38;
											}
											img.onerror = function() {
												// body...
												this.src ="./src/style/images/avt_default.png";
											};
											img.style.borderRadius = "100%";
											var json =JSON.parse(window.localStorage.getItem("esn_user"));

											if(src && !checkFileExt(src))
											{
												src = undefined;
											}
											if(src==undefined){
												var color = colorArr[i];
												var fontsize = "16";
												if($scope.fontsize) {
													fontsize = $scope.fontsize;
												}
												var header ="<div style='height: 100%; width: 100%;display: inline-flex;justify-content: center;align-items: center;font-size: "+fontsize+"px;color: #fff;background: #"+
												color +";border-radius: 100%;'>"+name+"</div>";
												element.append(header);
											} else {
												src = (src==undefined||src =="")?"./src/style/css/images/default_photo.jpg":src;
												img.src = src;
												element.append(img);
											}
										}
									},500);
								// }
							} else if (!item.type && !item.access_token) {
								var src;
								var itemname;
								if(item.owner){
									itemname = item.owner.name;

									src = item.owner.avatar || item.owner.photo;

								} else {
									if (item.group_logo) {
										src = item.group_logo;
									} else if(item.avatar){
										src = item.avatar;
									}

									if (item.vcard && !item.other_avatar) {
										 src = item.vcard.avatar || item.vcard.photo;
									}
									else if(item.other_avatar){
										 src = item.other_avatar;
									}
									if (item.group_name) {
										itemname = item.group_name;
									} else {
										itemname = item.name || item.uname  || item.from.name ;
									}
								}
								if (src && (src.indexOf("default_avatar.jpg")>-1 || src.indexOf("defaultGroup.gif")>-1)) {
									src = "";
								}
								var i;
								var maxlength =  itemname.length;
								var minlength = (maxlength > 2) ? maxlength-2 : 0;
								var name = "";
								if(/.*[\u4e00-\u9fa5]+.*$/.test(itemname)){
									i = $.md5(itemname.substring(minlength,maxlength)).substring(0,1);
									name = itemname.substring(minlength,maxlength);
									if(subData.indexOf(i) > -1){
										i = subData.indexOf(i);
									}
									if (i>7) {
										i = (i+1)%8;
									}
								} else {
									var maxlength = (itemname.length < 2) ? itemname.length : 2;

									i = $.md5(itemname.substring(0,maxlength)).substring(0,1);
									name = itemname.substring(0,maxlength);
									if(subData.indexOf(i) > -1){
										i = subData.indexOf(i);
									}
									if (i>7) {
										i = (i+1)%8;
									}
								}

								var img =  new Image();
								if($scope.size){
									element.css("height",$scope.size);
									element.css("width",$scope.size);
									// borderSolid ="border:1px solid #dedede;";

									img.width = $scope.size;
									img.height = $scope.size;
								} else {

									img.width = 38;
									img.height = 38;
								}
								img.onerror = function() {
									// body...
									this.src ="./src/style/images/avt_default.png";
								};
								img.style.borderRadius = "100%";
								var json =JSON.parse(window.localStorage.getItem("esn_user"));

								if (item.vcard  && json.muid == item.vcard.id) {
									item.vcard.avatar = json.avatar_middle;
								}

								if(src && !checkFileExt(src))
								{
									src = undefined;
								}
								if(src==undefined||src ==""){
									var color = colorArr[i];
									var fontsize = "16";
									if($scope.fontsize) {
										fontsize = $scope.fontsize;
									}
									var teamclass = '';
									if (item.group_name) {
										name = "";
										teamclass = "icon-web_icon_message_group";
									}
									var header ="<div class='"+teamclass+"' style='height: 100%; width: 100%;display: inline-flex;justify-content: center;align-items: center;font-size: "+fontsize+"px;color: #fff;background: #"+
									color +";border-radius: 100%;'>"+name+"</div>";
									element.append(header);
								} else {
									src = (src==undefined||src =="")?"./src/style/css/images/default_photo.jpg":src;
									img.src = src;
									element.append(img);
								}
							} else if (!item.type && item.access_token) {
								// console.log();
								// avatar_middle
								//uname
								var itemname = item.uname;
								var i;
								var maxlength =  itemname.length;
								var minlength = (maxlength > 2 ) ? maxlength-2 : 0;
								var name = "";
								if(/.*[\u4e00-\u9fa5]+.*$/.test(itemname)){
									i = $.md5(itemname.substring(minlength,maxlength)).substring(0,1);
									name = itemname.substring(minlength,maxlength);
									if(subData.indexOf(i) > -1){
										i = subData.indexOf(i);
									}
									if (i>7) {
										i = (i+1)%8;
									}
								} else {
									var maxlength = (itemname.length < 2) ? itemname.length : 2;

									i = $.md5(itemname.substring(0,maxlength)).substring(0,1);
									name = itemname.substring(0,maxlength);
									if(subData.indexOf(i) > -1){
										i = subData.indexOf(i);
									}
									if (i>7) {
										i = (i+1)%8;
									}
								}
								var src = item.avatar_middle;
								var img =  new Image();

								img.width = 40;
								img.height = 40;
								img.onerror = function() {
									// body...
									this.src ="./src/style/images/avt_default.png";
								};
								img.style.borderRadius = "100%";

								if(src && !checkFileExt(src))
								{
									src = undefined;
								}
								var borderSolid="";
								if($scope.size){
									element.css("height",$scope.size);
									element.css("width",$scope.size);
									borderSolid ="border:1px solid #dedede;";
								} else {
									element.css("height",40);
									element.css("width",40);
								}
								if(src==undefined || src==""){
									var color = colorArr[i];

									var fontsize = "16";
									if($scope.fontsize) {
										fontsize = $scope.fontsize;
									}
									var header ="<div style='height: 100%; width: 100%;display: inline-flex;justify-content: center;align-items: center;font-size: "+fontsize+"px;color: #fff;background: #"+
									color +";border-radius: 100%;"+borderSolid+"'>"+name+"</div>";
									element.append(header);
								} else {
									src = (src==undefined||src =="")?"./src/style/css/images/default_photo.jpg":src;
									img.src = src;
									element.append(img);
								}


							} else if (item.type == "fileItemWhichFromSelf"||item.type == "photoItemWhichFromSelf") {
								var itemname = item.sendername;
								var i;
								var maxlength =  itemname.length;
								var minlength = (maxlength > 2 ) ? maxlength-2 : 0;
								var name = "";
								if(/.*[\u4e00-\u9fa5]+.*$/.test(itemname)){
									i = $.md5(itemname.substring(minlength,maxlength)).substring(0,1);
									name = itemname.substring(minlength,maxlength);
									if(subData.indexOf(i) > -1){
										i = subData.indexOf(i);
									}
									if (i>7) {
										i = (i+1)%8;
									}
								} else {
									var maxlength = (itemname.length < 2) ? itemname.length : 2;

									i = $.md5(itemname.substring(0,maxlength)).substring(0,1);
									name = itemname.substring(0,maxlength);
									if(subData.indexOf(i) > -1){
										i = subData.indexOf(i);
									}
									if (i>7) {
										i = (i+1)%8;
									}
								}
								var img =  new Image();
								img.width = 38;
								img.height = 38;
								img.onerror = function() {
									// body...
									this.src ="./src/style/images/avt_default.png";
								};
								img.style.borderRadius = "100%";
								var src = item.avaster;
								if(src && !checkFileExt(src))
								{
									src = undefined;
								}
								if(src==undefined || src==""){
									var color = colorArr[i];
									var fontsize = "16";
									if($scope.fontsize) {
										fontsize = $scope.fontsize;
									}
									var header ="<div style='height: 100%; width: 100%;display: inline-flex;justify-content: center;align-items: center;font-size: "+fontsize+"px;color: #fff;background: #"+
									color +";border-radius: 100%;'>"+name+"</div>";
									element.append(header);
								} else {
									src = (src==undefined||src =="")?"./src/style/css/images/default_photo.jpg":src;
									img.src = src;
									element.append(img);
								}
							} else if(item.type=='chat'){
				        var json =JSON.parse(window.localStorage.getItem("esn_user"));
								if(item.from){
									if (json.muid == item.from.id) {
										item.from.vcard.avatar = json.avatar_middle;
									}
								}
								var itemname ;
								if (item.from) {
									itemname = item.from.name;
								} else {
									itemname = item.name;
								}
								var i;
								var maxlength =  itemname.length;
								var minlength = (maxlength > 2 ) ? maxlength-2 : 0;
								var name = "";
								if(/.*[\u4e00-\u9fa5]+.*$/.test(itemname)){
									i = $.md5(itemname.substring(minlength,maxlength)).substring(0,1);
									name = itemname.substring(minlength,maxlength);
									if(subData.indexOf(i) > -1){
										i = subData.indexOf(i);
									}
									if (i>7) {
										i = (i+1)%8;
									}
								} else {
									var maxlength = (itemname.length < 2) ? itemname.length : 2;

									i = $.md5(itemname.substring(0,maxlength)).substring(0,1);
									name = itemname.substring(0,maxlength);
									if(subData.indexOf(i) > -1){
										i = subData.indexOf(i);
									}
									if (i>7) {
										i = (i+1)%8;
									}
								}

								var img =  new Image();
								img.width = 38;
								img.height = 38;
								img.onerror = function() {
									// body...
									this.src ="./src/style/images/avt_default.png";
								};
								img.style.borderRadius = "100%";
								var src = undefined;
								if (item.from) {
									src = item.from.vcard.avatar || item.from.vcard.photo;
									if(src && !checkFileExt(src))
									{
										src = undefined;
									}
								}
								var borderSolid="";
								if($scope.size){
									element.css("height",$scope.size);
									element.css("width",$scope.size);

									img.width = $scope.size;
									img.height = $scope.size;
									borderSolid ="border:1px solid #dedede;";
								}
								if(src==undefined){
									var color = colorArr[i];

									var fontsize = "16";
									if($scope.fontsize) {
										fontsize = $scope.fontsize;
									}
									var header ="<div style='height: 100%; width: 100%;display: inline-flex;justify-content: center;align-items: center;font-size: "+fontsize+"px;color: #fff;background: #"+
									color +";border-radius: 100%;'>"+name+"</div>";

									element.append(header);
								} else {
									src = (src==undefined||src =="")?"./src/style/css/images/default_photo.jpg":src;
									img.src = src;
									element.append(img);
								}

						}else if(item.name&&item.type=='groupchat'){
							var members = item.from.members;
							var size = {
								"size1":{width:38,height:38},
								"size2":{width:29,height:29},
								"size3":{width:24,height:24},
								"size4":{width:22,height:22}
							};
							var pos ={
												"pos1":[{left:"0px",top:"0px"}],
												"pos2":[{left:"14px",top:"0px"},{left:"0px",top:"14px"}],
												"pos3":[{left:"0px",top:"18px"},{left:"9px",top:"0px"},{left:"18px",top:"18px"}],
												"pos4":[
													{left:"2px",top:"20px"},
													{left:"2px",top:"0px"},
													{left:"20px",top:"0px"},
													{left:"20px",top:"20px"}
												]
											};

							var len = members.length >4?4:members.length;
							if (len == 1 || item.from.groupType == "team") {
								var img = new Image();
								img.onerror = function() {
								// body...
								this.src ="./src/style/images/avt_default.png";
								 };
								var src = members[0].photo;//vcard.avatar;
								if(src && !checkFileExt(src))
								{
									src = undefined;
								}
								if (src == undefined || item.from.groupType == "team" || src.indexOf("defaultGroup.gif")>-1) {
									var itemname = item.name || item.from.name;
									var i;
									var maxlength =  itemname.length;
									var minlength = (maxlength > 2 ) ? maxlength-2 : 0;
									var name = "";
									if(/.*[\u4e00-\u9fa5]+.*$/.test(itemname)){
										i = $.md5(itemname.substring(minlength,maxlength)).substring(0,1);
										name = itemname.substring(minlength,maxlength);
										if(subData.indexOf(i) > -1){
											i = subData.indexOf(i);
										}
										if (i>7) {
											i = (i+1)%8;
										}
									} else {
										var maxlength = (itemname.length < 2) ? itemname.length : 2;

										i = $.md5(itemname.substring(0,maxlength)).substring(0,1);
										name = itemname.substring(0,maxlength);
										if(subData.indexOf(i) > -1){
											i = subData.indexOf(i);
										}
										if (i>7) {
											i = (i+1)%8;
										}
									}

									var group_logo = "";
									httpService.dataService("get","/group/info/"+item.from.teamId,function (json) {
											if(json && json.data){
												if(json.data.group_logo && json.data.group_logo!=""){
													group_logo = json.data.group_logo;
												}
											}
									},function (fail) {
										//  (params.errors && typeof(params.errors) ==='function') && param.errors(fail);
									},null,true);
									if (group_logo == "" || group_logo.indexOf("defaultGroup.gif")>-1) {
										var teamclass = "";
										var fsize = "16";
										if (item.from.groupType == "team") {
											name = "";
											teamclass = "icon-web_icon_message_group";
											fsize = "24";
										}
										var color = colorArr[i];
										var header ="<div class='"+teamclass+"' style='height: 100%; width: 100%;display: inline-flex;justify-content: center;align-items: center;font-size: "+fsize+"px;color: #fff;background: #"+
										color +";border-radius: 100%;'>"+name+"</div>";
										element.append(header);
									} else {
										img.src = group_logo;

										img.style.borderRadius = "100%";
										img.width = 38;
										img.height = 38;
										element.append(img);
									}

								} else {
									src = (src =="")?"./src/style/css/images/default_photo.jpg":src;
									img.src = src;
									img.width = size["size"+len].width;
									img.height = size["size"+len].height;
									img.style.position = "absolute";
									img.style.borderRadius = "100%";
									if(len>1){
										img.style.border = "2px solid #fff";
									}
									img.style.top = pos["pos"+len][0].top;
									img.style.left = pos["pos"+len][0].left;
									element.append(img);
								}
							} else {
								for(var i=0;i<len;i++){
									var img = new Image();
									img.onerror = function() {
									// body...
									this.src ="./src/style/images/avt_default.png";
								   };

									var src = members[i].photo;//vcard.avatar;
									if(src && !checkFileExt(src))
									{
										src = undefined;
									}
									if (src == undefined) {

										var itemname = item.from.members[i].name;
										var x;
										var maxlength =  itemname.length;
										var minlength = (maxlength > 2 ) ? maxlength-2 : 0;
										var name = "";
										if(/.*[\u4e00-\u9fa5]+.*$/.test(itemname)){
											x = $.md5(itemname.substring(minlength,maxlength)).substring(0,1);
											name = itemname.substring(minlength,maxlength);
											if(subData.indexOf(x) > -1){
												x = subData.indexOf(x);
											}
											if (x>7) {
												x = (x+1)%8;
											}
										} else {
											var maxlength = (itemname.length < 2) ? itemname.length : 2;

											x = $.md5(itemname.substring(0,maxlength)).substring(0,1);
											name = itemname.substring(0,maxlength);
											if(subData.indexOf(x) > -1){
												x = subData.indexOf(x);
											}
											if (x>7) {
												x = (x+1)%8;
											}
										}
										var color = colorArr[x];
										var header ="<div style='position:absolute;border: 2px #fff solid; top:"+pos["pos"+len][i].top+";left:"+pos["pos"+len][i].left
										+"; height: "+size["size"+len].height+"px; width: "+size["size"+len].width+"px;display: inline-flex;justify-content: center;align-items: center;font-size: 16px;color: #fff;background: #"+
										color +";border-radius: 100%;'><i style='-webkit-transform: scale(0.58);display: inline-block;width: 100%;font-size: 12px;'>"+name+"</i></div>";
										element.append(header);
									} else {
										src = (src =="")?"./src/style/css/images/default_photo.jpg":src;
										img.src = src;
										img.width = size["size"+len].width;
										img.height = size["size"+len].height;
										img.style.position = "absolute";
										img.style.borderRadius = "100%";
										if(len>1){
											img.style.border = "2px solid #fff";
										}
										img.style.top = pos["pos"+len][i].top;
										img.style.left = pos["pos"+len][i].left;
										element.append(img);
									}
									// src = (src==undefined||src =="")?"./src/style/css/images/default_photo.jpg":src;

								}
							}
						}else if(!item.name&&item.type=='groupchat'){
							var itemname = item.fromRoster.name;
							var i;
							var maxlength =  itemname.length;
							var minlength = (maxlength > 2 ) ? maxlength-2 : maxlength;
							var name = "";
							if(/.*[\u4e00-\u9fa5]+.*$/.test(itemname)){
								i = $.md5(itemname.substring(minlength,maxlength)).substring(0,1);
								name = itemname.substring(minlength,maxlength);
								if(subData.indexOf(i) > -1){
									i = subData.indexOf(i);
								}
								if (i>7) {
									i = (i+1)%8;
								}
							} else {
								var maxlength = (itemname.length < 2) ? itemname.length : 2;

								i = $.md5(itemname.substring(0,maxlength)).substring(0,1);
								name = itemname.substring(0,maxlength);
								if(subData.indexOf(i) > -1){
									i = subData.indexOf(i);
								}
								if (i>7) {
									i = (i+1)%8;
								}
							}
							var img =  new Image();
							img.width = 38;
							img.height = 38;
							img.onerror = function() {
								// body...
								this.src ="./src/style/images/avt_default.png";
							};
							img.style.borderRadius = "100%";
							var json =JSON.parse(window.localStorage.getItem("esn_user"));

							if (json.muid == item.fromRoster.id) {
								item.fromRoster.vcard.avatar = json.avatar_middle;
							}
							var src = item.fromRoster.vcard.avatar || item.fromRoster.vcard.photo;
							if(src && !checkFileExt(src))
							{
								src = undefined;
							}

							var borderSolid="";
							if($scope.size){
								element.css("height",$scope.size);
								element.css("width",$scope.size);
								borderSolid ="border:1px solid #dedede;";
							}
							if(src==undefined){
								var color = colorArr[i];

								var fontsize = "16";
								if($scope.fontsize) {
									fontsize = $scope.fontsize;
								}
								var header ="<div style='height: 100%; width: 100%;display: inline-flex;justify-content: center;align-items: center;font-size: "+fontsize+"px;color: #fff;background: #"+
								color +";border-radius: 100%;"+borderSolid+"'>"+name+"</div>";
								element.append(header);
							} else {
								src = (src==undefined||src =="")?"./src/style/css/images/default_photo.jpg": src;

								 if (src.indexOf('.thumb.jpg') === -1){
								 	   if (src.indexOf('.middle.jpg') > -1){
								 	   	   var pos10  = src.indexOf('.middle.jpg');
								 	   	   src = src.substring(0,pos10);
								 	   }
							    		src = src +'.thumb.jpg';
							     };

								img.src = src;
								element.append(img);
							}
						}else if(item.name&&item.type=='tixing'){

						}else if(item.name&&item.type=='folded'){
							var i;
							if(/.*[\u4e00-\u9fa5]+.*$/.test(item.name)){
								i = $.md5(item.name.substring(0,2)).substring(0,1);
								if(subData.indexOf(i) > -1){
									i = subData.indexOf(i);
								}
								if (i>7) {
									i = (i+1)%8;
								}
							}
							var color = "";
							if (attrs.headercolor) {
								color = attrs.headercolor;
							} else {
								item.colorNum = i;
								color = colorArr[i];
								if (element[0].offsetParent) {
									element[0].offsetParent.setAttribute("headercolor",color);
								}
							}
							// if(!color){
								color = colorArr[3];
							// }
							var header ="<div class='icon-web_icon_message_subscribe' style='height: 100%; width: 100%;display: inline-flex;justify-content: center;align-items: center;font-size: 24px;color: #fff;background: #"+
							color +";border-radius: 100%;'></div>";
							element.append(header);



						}else if(!item.businessType && item.type=='pubaccount'){
							// console.log(item);
							var i;
							var itemname = item.name || item.from.name;
							var classname = "";
							if(!item.name){
								element.addClass("photocard");
								element.addClass("z");
								classname = "photocard z ";
							}
							if(/.*[\u4e00-\u9fa5]+.*$/.test(itemname)){
								i = $.md5(itemname.substring(0,2)).substring(0,1);
								if(subData.indexOf(i) > -1){
									i = subData.indexOf(i);
								}
								if (i>7) {
									i = (i+1)%8;
								}
							}
							// console.log(1111);
							//icon-web_icon_message_subscribe
							var img =  new Image();
							img.width = 38;
							img.height = 38;
							img.onerror = function() {
								// body...
								this.src ="./src/style/images/avt_default.png";
							};
							img.style.borderRadius = "100%";
							var src = "";
							if (item.data) {
								src =	imgHost+item.data.extend.esndata.avatar;
							}

							if(src && !checkFileExt(src))
							{
								src = undefined;
							}
							if (src==undefined||src =="") {

								var color = "";
								if (attrs.headercolor) {
									color = attrs.headercolor;
								} else {
									item.colorNum = i;
									color = colorArr[item.colorNum];
									if (element[0].offsetParent) {
										element[0].offsetParent.setAttribute("headercolor",color);
									}
								}
								var classtype = "";
								//['29d4ff'：蓝,'1594ff'：深蓝,'ffa92f':橙,'b587fa'：紫,'06cf86'：绿,'fa6771'：红,'73d51c'：青,'8991ff'：淡紫]
								switch (item.from.noticyType) {
									case "app": //应用通知
										classtype = "icon-web_icon_message_application";
										color = colorArr[2];
										break;
									case "qz": //空间通知
										classtype = "icon-web_icon_message_space";
										color = colorArr[4];
										break;
									case "feed": //动态通知
										classtype = "icon-web_icon_message_dynamic";
										color = colorArr[4];
										break;
									case "groupnew"://团队通知
										classtype = "icon-web_icon_message_team";
										color = colorArr[2];
										break;
									case "system"://系统通知
										classtype = "icon-web_icon_set_selected";
										color = colorArr[1];
										break;
									case "vmail"://微邮通知
										classtype = "icon-web_icon_mail_selected";
										color = colorArr[7];
										break;
									default:
										classtype = "icon-web_icon_message_subscribe";
										// color = colorArr[7];
								}
								// icon-web_icon_message_space //空间
								// icon-web_icon_message_application //应用
								// icon-web_icon_message_subscribe //订阅号
								// icon-web_icon_message_dynamic //动态
								if (!color) {
									color = colorArr[7];
								}
								var header ="<div class='"+classtype+"' style='height: 100%; width: 100%;display: inline-flex;justify-content: center;align-items: center;font-size: 24px;color: #fff;background: #"+
								color +";border-radius: 100%;'></div>";

								element.append(header);
							} else {
								img.src = src;
								element.append(img);
							}


						}

					}
				}

	}]);
})
